package com.cat.conf;

import com.alibaba.druid.pool.DruidDataSource;
import com.cat.conf.spi.SpiPostProcessor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * ？
 *
 * @author xiemh
 * @date 2018/12/14 9:04
 * @since v1.0.0
 */
@Configuration
@EnableConfigurationProperties(CatProperties.class)
public class CatConfiguration {
    @Bean
    @Primary
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSource dataSource() {
        return new DruidDataSource();
    }


    @Bean
    public SpiPostProcessor spiPostProcessor(){
        return new SpiPostProcessor();
    }
}
